<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="main" style="width: 800px;height: 400px"></div>
  <script src="./lib/echarts.min.js"></script>
  <script>
    const myChart = echarts.init(document.querySelector('#main'))
    const option = {
      title: { // 标题组件
        text: '折线图',  // 主标题
        left: 'left'  // 居中位置
      },
      tooltip: {  // 提示组件
        trigger: 'axis' // 触发类型 axis 坐标轴触发  / item -> 自身项触发
      },
      legend: { // 图例组件
        // data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
      },
      grid: {  // 直角坐标系网格
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true // 是否包含刻度
      },
      toolbox: {  // 工具箱
        feature: {
          saveAsImage: {}
        }
      },
      xAxis: {  // x轴
        type: 'category',  // 离散的数据
        boundaryGap: false,
        data: ['星期一', '周二', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
      },
      yAxis: { // y轴
        // type: 'value'
      },
      series: [ // 系列是数据
        {
          name: 'Email',
          type: 'line',
          // stack: 'Total', // 数据堆叠
          data: [120, 132, 101, 134, 90, 230, 210]
        },
        {
          name: 'Union Ads',
          type: 'line',
          // stack: 'Total',
          data: [220, 182, 191, 234, 290, 330, 310]
        },
        {
          name: 'Video Ads',
          type: 'line',
          // stack: 'Total',
          data: [150, 232, 201, 154, 190, 330, 410]
        },
        {
          name: 'Direct',
          type: 'line',
          // stack: 'Total',
          data: [320, 332, 301, 334, 390, 330, 320]
        },
        {
          name: 'Search Engine',
          type: 'line',
          // stack: 'Total',
          data: [820, 932, 901, 934, 1290, 1330, 1320]
        }
      ]
    };
    myChart.setOption(option)
  </script>
</body>

</html>